/*
 * @Description: 
 * @Author: Yong
 * @Date: 2021-10-02 17:31:36
 * @LastEditTime: 2021-10-09 21:59:53
 */
/*
 * @Description: 好友模块
 * @Author: Yong
 * @Date: 2021-10-02 17:31:36
 * @LastEditTime: 2021-10-02 17:31:36
 */
import { Provide, Controller, Post, Inject, Body, ALL, Put, Del, Get, Query } from '@midwayjs/decorator'
import { AFO } from '../interface'
import { FriendsService } from '../service/Friends'
@Provide()
@Controller('/friends')
export class FriendsController {

    @Inject()
    friendsService: FriendsService

    /**
     * 申请好友
     */
    @Post('/apply')
    async register (@Body(ALL) applyFriendsObj: AFO) {
        await this.friendsService.applyFriends(applyFriendsObj)
    }

    /**
     * 同意好友申请
     */
    @Put('/updateFriendStates')
    async updateFriendStates (@Body(ALL) updateFriendObj: AFO) {
        await this.friendsService.updateFriendStates(updateFriendObj)
    }

    
    /**
     * 拒绝好友申请
     */
     @Del('/delFriends')
     async delFriends (@Body(ALL) delFriendObj: AFO) {
         console.log('delFriendObj ==>', delFriendObj)
         await this.friendsService.delFriends(delFriendObj)
    }
    
    /**
     * 获取好友申请列表
     */
    @Get('/getApplyFriendsList')
    async getApplyFriendsList (@Query() U_UserID: string) {
        await this.friendsService.getApplyFriendsList(U_UserID)
    }
}
